﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using tracker.Models.BLL;
using tracker.Models;

namespace tracker.Controllers
{
    public class ListDefineStatus
    {
        public static List<ObjListDefineStatus> getList()
        {
            List<ObjListDefineStatus> list = new List<ObjListDefineStatus>();
            list.Add(new ObjListDefineStatus("Output1", 0, "vi"));
            list.Add(new ObjListDefineStatus("Output2", 1, "vi"));
            list.Add(new ObjListDefineStatus("Output3", 2, "vi"));
            list.Add(new ObjListDefineStatus("Output4", 3, "vi"));
            list.Add(new ObjListDefineStatus("Output5", 4, "vi"));
            list.Add(new ObjListDefineStatus("Input1", 8, "vi"));
            list.Add(new ObjListDefineStatus("Input2", 9, "vi"));
            list.Add(new ObjListDefineStatus("Input3", 10, "vi"));
            list.Add(new ObjListDefineStatus("Input4", 11, "vi"));
            list.Add(new ObjListDefineStatus("Input5", 12, "vi"));

            list.Add(new ObjListDefineStatus("Output1", 0, "en-US"));
            list.Add(new ObjListDefineStatus("Output2", 1, "en-US"));
            list.Add(new ObjListDefineStatus("Output3", 2, "en-US"));
            list.Add(new ObjListDefineStatus("Output4", 3, "en-US"));
            list.Add(new ObjListDefineStatus("Output5", 4, "en-US"));
            list.Add(new ObjListDefineStatus("Input1", 8, "en-US"));
            list.Add(new ObjListDefineStatus("Input2", 9, "en-US"));
            list.Add(new ObjListDefineStatus("Input3", 10, "en-US"));
            list.Add(new ObjListDefineStatus("Input4", 11, "en-US"));
            list.Add(new ObjListDefineStatus("Input5", 12, "en-US"));

            list.Add(new ObjListDefineStatus("输出1", 0, "zh-CN"));
            list.Add(new ObjListDefineStatus("输出2", 1, "zh-CN"));
            list.Add(new ObjListDefineStatus("输出3", 2, "zh-CN"));
            list.Add(new ObjListDefineStatus("输出4", 3, "zh-CN"));
            list.Add(new ObjListDefineStatus("输出5", 4, "zh-CN"));
            list.Add(new ObjListDefineStatus("输入1", 5, "zh-CN"));
            list.Add(new ObjListDefineStatus("输入2", 9, "zh-CN"));
            list.Add(new ObjListDefineStatus("输入3", 10, "zh-CN"));
            list.Add(new ObjListDefineStatus("输入4", 11, "zh-CN"));
            list.Add(new ObjListDefineStatus("输入5", 12, "zh-CN"));

            return list;
        }

        public static int getID(string _Name, string gpslang)
        {
            //string gpslang = context.Request.Cookies["gpslang"] == null ? "vi" : context.Request.Cookies["gpslang"].Value;
            int i = 0;
            foreach (ObjListDefineStatus item in getList())
            {
                if (item.Name == _Name && item.Lang == gpslang)
                    i = item.ID;
            }
            return i;
        }
        public static string getName(string _id, string gpslang)
        {
            //string gpslang = context.Request.Cookies["gpslang"] == null ? "vi" : context.Request.Cookies["gpslang"].Value;
            string i = "";
            int id = int.Parse(_id);
            foreach (ObjListDefineStatus item in getList())
            {
                if (item.ID == id && item.Lang == gpslang)
                    i = item.Name;
            }
            return i;
        }
    }

    public class ObjListDefineStatus
    {
        public ObjListDefineStatus(string _name, int _id, string lang)
        {
            this.Name = _name;
            this.ID = _id;
            this.Lang = lang;
        }
        public string Name { get; set; }
        public string Lang { get; set; }
        public int ID { get; set; }
    }
}
